package com.lc.index.controller.api;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import com.lc.common.annotation.Anonymous;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.lc.common.annotation.Log;
import com.lc.common.core.controller.BaseController;
import com.lc.common.core.domain.AjaxResult;
import com.lc.common.enums.BusinessType;
import com.lc.index.domain.Orders;
import com.lc.index.service.OrdersService;
import com.lc.common.utils.poi.ExcelUtil;
import com.lc.common.core.page.TableDataInfo;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 存储订单基本信息Controller
 *
 * @author autoGen
 * @date 2025-03-12
 */
@Api(value="存储订单基本信息",tags = "存储订单基本信息")
@RestController
@Anonymous
@RequestMapping("api/index/orders")
public class OrdersCtrl extends BaseController
{
    @Resource
    private OrdersService ordersService;

    @ApiOperation(value="生成订单",notes="生成订单基本信息")
    @PostMapping("/createOrders")
    public Boolean createOrders(Orders orders){
        try {
            return ordersService.createOrders(orders);
        }catch (Exception e){
            e.printStackTrace();
            return false;
        }
    }

    @ApiOperation(value="根据用户id获取订单信息",notes="根据用户id获取订单信息")
    @GetMapping("/getOrdersByUserId")
    public Orders getOrdersByUserId(Integer userId)
    {
        return ordersService.getOrdersByUserId(userId);
    }
}
